<template>
  <div class="go-top-btn-box flex-col-center" @click="goTop">
    <div>
      <i class="el-icon-arrow-up"></i>
    </div>
    <div>顶部</div>
  </div>
</template>

<script>
export default {
  name: "GoTop",
  methods:{
    goTop(){
      window.scroll(0,0)
    }
  }
}
</script>

<style scoped lang="less">
  .go-top-btn-box{
    position: fixed;
    z-index: 999;
    width: 3em;
    height: 3em;
    font-size: 14px;
    bottom: 10px;
    right: 10px;
    background-color: white;
    cursor: pointer;
    border-radius: 5px;
    border: 1px solid #c9c8c8;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    caret-color: transparent;
    &:hover{
      background-color: #d7d7d7;
    }
  }
</style>